package com.maiji.cloud.config;

import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;

@Configuration
public class ESConfig {

//    @Value("${spring.data.elasticsearch.cluster-name}")
//    private String cluster_name;
//
//    @Value("${spring.data.elasticsearch.cluster-nodes}")
//    private String cluster_nodes;
//
//    @Bean
//    public TransportClient client() throws UnknownHostException {
//
//
//        InetSocketTransportAddress node = new InetSocketTransportAddress(InetAddress.getByName(cluster_nodes),9300);
//
//        Settings settings = Settings.builder()
//                .put("cluster.name",cluster_name).build();
//
//        TransportClient client = new PreBuiltTransportClient(settings);
//
//        return client;
//    }


}
